<div component="composer" class="composer resizable reply" id="cmp-uuid-3d185bf1-2f3e-4ac8-9d80-87b32196d10d" style="visibility: visible;">
	<div class="composer-container">
		<nav class="navbar navbar-fixed-top mobile-navbar visible-xs visible-sm">
			<div class="pull-left">
				<button class="btn btn-default composer-discard" href="{$WEBPATH}/bbs/{$bid}"><i class="fa fa-times"></i> 撤销</button>
			</div>
			<div class="pull-right">
				<button class="btn btn-primary composer-submit" id="submit"><i class="fa fa-check"></i> 提交</button>
			</div>
			<h4 class="title">正在回复 "{$bbstitle}"</h4>
		</nav>
		<div class="row title-container">
			<div class="col-lg-12 col-md-12">
				<span class="title form-control">正在回复 "{$bbstitle}"</span>
			</div>
		</div>
		<div class="category-tag-row">
			<div class="btn-toolbar formatting-bar">
				<div class="btn-group pull-right action-bar hidden-sm hidden-xs">
					<button class="btn btn-default composer-discard" href="{$WEBPATH}/bbs/{$bid}"><i class="fa fa-times"></i> 撤销</button>
					<button class="btn btn-primary composer-submit" id="submit"><i class="fa fa-check"></i> 提交</button>
				</div>
			</div>
		</div>
        <div id="test-editor"></div>
	</div>
</div>
<script>
    var editor=loadEditor("test-editor");
    $('[id="submit"]').click(function(){//提交评论
    var bid={$bid};
    var rid={$rid};
    var text=$('[class="write"]').val();
    var pushed=false;
    var data={type:2,bid:bid,rid:rid,replyText:editor.getContent(),token:"{$token}"};
    if(layer!=null){
        pushed=true;
        $.ajax({
            url:"{$WEBPATH}/api/bbs/reply",
            method:"POST",
            dataType:"json",
            data:data,
            success:function(res){
                layer.msg(res.msg);
                if(res.code==200){
                    window.location.href="{$WEBPATH}/bbs/{$bid}";
                    $('[component="composer"]').css("visibility","hidden");
                    $('#test-editor').css("visibility","hidden");
                }
            }
        });        
    }else if(pushed){
        alert("你已提交成功，请勿重复提交");
    }else{
        alert("组件未加载成功,请刷新页面重试");
    }
});
</script>